<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/employer/tmpl/controlpanel.php
 ^
 * Description: template view for control panel
 ^
 * History:		NONE
 ^
 */

defined('_JEXEC') or die('Restricted access');
global $mainframe;
$document =& JFactory::getDocument();
$document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
$colperrow=2;
$colwidth = round(100/$colperrow,1);
$colwidth = $colwidth.'%';

?>

<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td valign="top" class="<?php echo $this->theme['title']; ?>"><?php echo $this->config['title']; ?>
		</td>
	</tr>
	<tr>
		<td height="25"></td>
	</tr>
	<tr>
		<td class="wrecruitmsg"><?php echo $this->config['offline_text']; ?>
		</td>
	</tr>
</table>
<?php }else{ ?>


<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td valign="top" class="<?php echo $this->theme['title']; ?>"><?php echo $this->config['title']; ?>
		</td>
	</tr>
	<tr>
		<td height="23"></td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr>
		<td height="0"></td>
	</tr>
	<tr>
		<td class="curloc"><?php echo JText::_('JS_CUR_LOC'); ?> : <?php echo JText::_('JS_EMPLOYER_C_P'); ?>
		</td>
	</tr>
	<?php } ?>
	<tr nowrap><td>
		<?php 
			if (sizeof($this->employerlinks) != 0){
				echo '<div id="toplinks"><ul>';
				foreach($this->employerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>
					</span>
				<?php }
				echo '<ul></div>';			
			}
		?>
	</td></tr>
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_EMPLOYER_C_P'); ?> 
	</td></tr>

	<tr><td height="10"></td></tr>
</table>

<?php
if (isset($this->userrole->rolefor)){
        if ($this->userrole->rolefor == 1) // employer
            $allowed = true;
        else
            $allowed = false;
}else { if ($this->config['visitorview_emp_conrolpanel'] == 1) $allowed = true; else $allowed = false; } // user not logined
if ($allowed == true) {
?>

	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
		<tr>
			<td>
				<table cellpadding="0" cellspacing="0" border="0" width="100%" >
					<tr>
						<td height="15"></td>
					</tr>
				</table>
			</td>
		</tr>	
		<tr>
			<td>
				<table cellpadding="0" cellspacing="0" border="0" width="100%" >
					<tr>
						<td width="47%" valign="top">
							<table cellpadding="0" cellspacing="0" border="0" width="100%" >
							<?php if ($this->emcontrolpanel['formcompany'] == 1) {
								$colcount=0;?>
								<tr>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/new.png" alt="New Company" />
									 <a  class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=formcompany&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_NEW_COMPANY'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['alljobsappliedapplications'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/appliedjobs.png" alt="Applied Resume" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=alljobsappliedapplications&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_APPLIED_RESUME'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['mycompanies'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/company.png" alt="My Companies" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=mycompanies&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MY_COMPANIES'); ?> </a> 
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['resumesearch'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/search.png" alt="Search Resume" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=resumesearch&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_SEARCH_RESUME'); ?> </a> 
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['formjob'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/new.png" alt="New Job" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=formjob&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_NEW_JOB'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['my_resumesearches'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/save.png" alt="Search Resume" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=my_resumesearches&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_RESUME_SAVE_SEARCHES'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['myjobs'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/job.png" alt="My Jobs" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=myjobs&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MY_JOBS'); ?> </a> 
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['packages'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/packages.png" alt=" Packages" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=packages&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_PACKAGES'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['formdepartment'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24"  src="components/com_wrecruit/images/new.png" alt="Form Department" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=formdepartment&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_NEW_DEPARTMENT'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['purchasehistory'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/purchase_history.png" alt=" Employer Purchase History" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=purchasehistory&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_PURCHASE_HISTORY'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['mydepartment'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/departments.png" alt="My Department" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=mydepartments&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MY_DEPARTMENTS'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['my_stats'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/mystats.png" alt="My Stats" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=my_stats&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MY_STATS'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['empmessages'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img  align="left" width="24" height="24" src="components/com_wrecruit/images/messages.png" alt="Messages" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=empmessages&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_MESSAGES'); ?>  </a>
									<?php echo '</td>'?>
							<?php } ?>
							<?php if ($this->emcontrolpanel['myfolders'] == 1) {?>
								<?php if($colcount == $colperrow){ echo '</tr><tr>';  $colcount = 0; } $colcount++; 	?>
									<?php echo '<td nowrap="nowrap" width="'.$colwidth.'">'?>
									 <img align="left" width="24" height="24" src="components/com_wrecruit/images/folders.png" alt="My Folders" />
									<a class="cplinks" href="index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=myfolders&Itemid=<?php echo $this->Itemid; ?>"><?php echo JText::_('JS_FOLDERS'); ?>  </a>
									<?php echo '</td>'?>
							<?php } 
								for($i = $colcount; $i < $colperrow; $i++){
									echo '<td width="'.$colwidth.'"></td>';
								}
								echo '</tr>';
								$colcount=0;
								?>
						
						</table>
					</td>
				</tr>

			</table>
		</td>
	</tr>
	<tr>
		<td></td>
	</tr>
</table>
								<?php
		} else{ // not allowed job posting
			//Update by Vireak on 09/08/2012
			//Add frame to this warning and some styling
			//---------------------
			echo '<div class="box-list"><div class="head-title"><h2>Oop!</h2></div>';
			echo '<span class="wr_info"><p>'.JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW').'</p>';
			echo '<p>This page is reserved for the authorized employers or recruiters only. </p></span>';
			echo '</div>';
			//---------------------
		}
}//ol
?>
<div width="100%">
<?php
if($this->config['fr_cr_txsh']) {
	echo
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}
?>
</div>
